//
//  AFNetworkUtils.h
//  WeiAiPin
//
//  Created by 猫王之王 on 1/7/21.
//  Copyright © 2021 tudu. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface AFNetworkUtils : NSObject



+(NSURLSessionTask *)POST_RawToken:(NSString *)url body:(id)parameter head:(nullable NSDictionary <NSString *, NSString *> *)head success:(void(^)(NSDictionary *responseObject))success failure:(void(^)(NSString *error))failure;
//POST Raw 格式
+(NSURLSessionTask *)POST_Raw:(NSString *)url body:(id)parameter head:(nullable NSDictionary <NSString *, NSString *> *)head success:(void(^)(NSDictionary *responseObject))success failure:(void(^)(NSString *error))failure;

//POST form-data 格式
+(NSURLSessionTask *)POST:(NSString *)url body:(id)parameters head:(nullable NSDictionary <NSString *, NSString *> *)head success:(void(^)(NSDictionary *responseObject))success failure:(void(^)(NSString *error))failure;

//GET
+(NSURLSessionTask *)GET:(NSString *)url body:(NSDictionary *)dic success:(void(^)(NSDictionary *responseObject))success failure:(void(^)(NSString *error))failure;

//GET
+(NSURLSessionTask *)GET:(NSString *)url body:(NSDictionary *)dic head:(nullable NSDictionary <NSString *, NSString *> *)head success:(void(^)(NSDictionary *responseObject))success failure:(void(^)(NSString *error))failure;



//PUT
+(NSURLSessionTask *)PUT:(NSString *)url body:(NSDictionary *)dic success:(void(^)(NSDictionary *responseObject))success failure:(void(^)(NSString *error))failure;
//DELETE
+(NSURLSessionTask *)DELETE:(NSString *)url body:(NSDictionary *)dic success:(void(^)(NSDictionary *responseObject))success failure:(void(^)(NSString *error))failure;

//上传图片
+(void)photo:(NSString *)url body:(NSDictionary *)dic photoData:(NSData *)data fileName:(NSString *)name success:(void(^)(NSDictionary *responseObject))success failure:(void(^)(NSString *error))failure;


//网络监测
+(void)AFNetworkStatus:(void(^)(NSInteger state))state;

+ (BOOL)isNetwork;

+ (BOOL)isWWANNetwork;

+ (BOOL)isWiFiNetwork;
//退出所有的线程
+(void)cancelAllRequest;
@end

NS_ASSUME_NONNULL_END
